package com.zhixianggou.caibaobox.commons.config;

import jakarta.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;



@Configuration
public class RedisConfig {


    @Value("${redis.data.ip}")
    private String data_ip;
    @Value("${redis.data.port}")
    private int data_port;
    @Value("${redis.data.password}")
    private String data_password;
    @Value("${redis.session.ip}")
    private String session_ip;
    @Value("${redis.session.port}")
    private int session_port;
    @Value("${redis.session.password}")
    private String session_password;



    private static String dataIp;
    private static int dataPort;
    private static String dataPwd;
    private static String sessionIp;
    private static int sessionPort;
    private static String sessionPwd;


    @PostConstruct
    public void setDataIp( ) {
        dataIp = this.data_ip;
    }

    @PostConstruct
    public void setDatePort() {
        dataPort = this.data_port;
    }

    @PostConstruct
    public void setDataPwd( ) {
        dataPwd = this.data_password;
    }

    @PostConstruct
    public void setSessionIp( ) {
        sessionIp = this.session_ip;
    }

    @PostConstruct
    public void setSessionPort( ) {
        sessionPort = this.session_port;
    }

    @PostConstruct
    public void setSessionPwd( ) {
        sessionPwd = this.session_password;
    }

    public static String getDataIp() {
        return dataIp;
    }

    public static int getDataPort() {
        return dataPort;
    }

    public static String getDataPwd() {
        return dataPwd;
    }

    public static String getSessionIp() {
        return sessionIp;
    }

    public static int getSessionPort() {
        return sessionPort;
    }

    public static String getSessionPwd() {
        return sessionPwd;
    }
}
